<?php
include 'header.php';
?>
<style>
<!--
dl{ display:block;width:96%;height:auto;margin:10px auto;clear:both;border-bottom:1px dotted #DEDEDE}
	dl dt{font-weight:bold;font-size:14px;color:#008000;border-bottom:1px solid #008000;line-height:30px;clear:both;height:auto}
	dl dd{ line-height:2em;height:auto;clear:both}
-->
</style>
<div class="pageBox">

<div class="archiveBox">
<dl>
	<dd>
		<label for="department_id">您正在对<font color="#FF0000"><?php echo $department['name'];?></font>发表留言，留言内容将会在管理员回复之后显示</label><br/><input type="hidden" name="department_id" value="<?php echo $department['id'];?>" />
		<!--<select name="department_id">
			<option value="0">请选择</option>
		    <?php foreach($departmentList as $item):?>
		    <option value="<?php echo $item['id'];?>" <?php if($department['id']==$item['id']):?>selected="selected"<?php endif;?>>
		    <?php echo str_repeat('-', $item['level']-1), $item['name'];?>
		    </option>
		    <?php endforeach;?>
		</select>-->
	</dd>
	<dd>
		<span for="name">您的姓名</span><br/>
		<input type="text" name="name" style="width:300px; height:26px; line-height:26px;" />
	</dd>
	<dd>
		<span for="text">您的留言（不能超过三百字）</span><br/>
		<textarea name="text" style="width:600px; height:160px; line-height:26px;"></textarea>
	</dd>
	<dd>
	<button id="save">提交</button>
	</dd>
</dl>
</div>
</div>
<?php
include 'footer.php';
?>
<script type="text/javascript" src="/ria/default/jquery.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
	$('#save').live('click', function(){
		var author = $("input[name='name']").val();
		var content = $("textarea[name='text']").val();
		var department_id = $("input[name='department_id']").val();
		if(department_id==0 || department_id==''){
			alert('请选择您要留言的单位');
			return false;
		}
		if(author==''){
			alert('请填写姓名');
			return false;
		}
		if(content==''){
			alert('请填写内容');
			return false;
		}
		$.post(
			'/api/comment/save',
			{
				department_id: department_id,
				author: author,
				content: content
			},function(ret){
				if(ret.code==200){
					alert('感谢您的留言');
					window.location.href='/';
				}else{
					alert(ret.msg);
					return false;
				}
			},'JSON'
		);
	});
});
-->
</script>